<template>
  <div>
    <el-dialog v-bind="$attrs" v-on="$listeners" :visible.sync="isOpen" :title="title">
      <el-form ref="elForm" :model="formData" :rules="rules" size="medium" label-width="100px">
        <el-form-item label="新提现密码" prop="newPwd">
          <el-input v-model="formData.newPwd" placeholder="请输入密码" clearable show-password
                    :style="{width: '100%'}"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer">
        <el-button @click="close">取消</el-button>
        <el-button type="primary" @click="handelConfirm">确定</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
  import {resetPwd} from '@/api/station/account';

  export default {
    name:'resetPwd',
    inheritAttrs: false,
    components: {},
    props: {
      updateId:{
         type:Number
       }
    },
    data() {
      return {
        //标题
        title:"重置提现密码",
        //打开窗口
        isOpen:false,
        formData: {
          id: this.updateId,
          newPwd: '',
        },
        // 表单参数
        form: {},
        rules: {
          field101: [{
            required: true,
            message: '请输入密码',
            trigger: 'blur'
          }],
        },
      }
    },
    computed: {},
    watch: {},
    created() {},
    mounted() {},
    methods: {
      open() {
        this.isOpen = true
      },
      resetForm() {
        this.formData = {
          id:undefined,
          newPwd:undefined
        }
      },
      close() {
        this.isOpen = false;
        this.resetForm();
      },
      handelConfirm() {
        this.$refs['elForm'].validate(valid => {
          if (!valid)return
            this.formData.id = this.updateId;
            resetPwd(this.formData).then(response => {
              if (response.code === 200) {
                this.msgSuccess("重置成功");
              }else{
                this.msgSuccess("重置失败请重试");
              }
            })
          this.close()
        })
      },
    }
  }

</script>
<style>
</style>
